<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Movil.master" AutoEventWireup="true" CodeFile="ReservaMovil.aspx.cs" Inherits="ReservaMovil" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style1
        {
            height: 21px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <br />
    
  <center>
      <asp:Panel ID="Panel1" runat="server" HorizontalAlign="Center">
        <asp:Label ID="Labelmensaje" runat="server"></asp:Label>
        </asp:Panel>
  <asp:FormView ID="FormView1" runat="server" DataSourceID="odsVenta" 
        AllowPaging="True" ondatabound="FormView1_DataBound1">
        <EditItemTemplate>
            IdentificadorUsuario:
            <asp:TextBox ID="IdentificadorUsuarioTextBox" runat="server" 
                Text='<%# Bind("IdentificadorUsuario") %>' />
            <br />
            ValorCompra:
            <asp:TextBox ID="ValorCompraTextBox" runat="server" 
                Text='<%# Bind("ValorCompra") %>' />
            <br />
           
            FechaVenta:
            <asp:TextBox ID="FechaVentaTextBox" runat="server" 
                Text='<%# Bind("FechaVenta") %>' />
            <br />
            PorTiquete:
            <asp:CheckBox ID="PorTiqueteCheckBox" runat="server" 
                Checked='<%# Bind("PorTiquete") %>' />
            <br />
            
            
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                CommandName="Update" Text="Actualizar" />
            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
        </EditItemTemplate>
        <InsertItemTemplate>
      
            <table class="style1"  style="background-color: #FAFAD2;color: #284775;">
                <tr>
                    <th colspan="2">
                        Reserva</th>
    
                </tr>
                <tr>
                    <td>
                        Nombre:
                    </td>
                    <td   style="background-color: #FAFAD2;color: #ffffff;">
                        <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="odsCodeUser" 
                            DataTextField="Nombre" DataValueField="Codigo" Enabled="False" 
                            SelectedValue='<%# Bind("IdentificadorUsuario") %>' 
                            onselectedindexchanged="DropDownList2_SelectedIndexChanged">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        Menu:</td>
                    <td>
                        <asp:DropDownList ID="DropDownList4" runat="server" AppendDataBoundItems="True" 
                            AutoPostBack="True" DataSourceID="odsMenuPorFecha" DataTextField="Nombre" 
                            DataValueField="Codigo" 
                            onselectedindexchanged="DropDownList4_SelectedIndexChanged">
                            <asp:ListItem Value="4">Seleccionar menu</asp:ListItem>
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                            ControlToValidate="ValorCompraTextBox" ErrorMessage="Seleccione un menu" 
                            ValidationGroup="Validadores">Selecion obligatoria.</asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        Valor:
                    </td>
                    <td>
                        <asp:TextBox ID="ValorCompraTextBox" runat="server" 
                            Text='<%# Bind("ValorCompra") %>' Enabled="False" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Compra:
                    </td>
                    <td>
                        <asp:TextBox ID="FechaCompraTextBox" runat="server" Enabled="False" 
                            Text='<%# Bind("FechaCompra") %>' Height="22px" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Reserva:&nbsp;</td>
                    <td>
                        <asp:CheckBox ID="EsReservaCheckBox" runat="server" 
                            Checked='<%# Bind("EsReserva") %>' />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                            CommandName="Insert" Text="Comprar" onclick="InsertButton_Click" ValidationGroup="Validadores"/>
                        <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" 
                            CommandName="Cancel" Text="Cancelar" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:HyperLink ID="HyperLink1" runat="server" 
                            NavigateUrl="~/SeleccionMovil.aspx">Volver</asp:HyperLink>
                    </td>
                </tr>
            </table>
        </InsertItemTemplate>
        <ItemTemplate>
           <center> <table  style="background-color: #FAFAD2;color: #284775;">
                <tr>
                    <th colspan="2">
                        Reservas</th>
                </tr>
                <tr>
                    <td align="right">
                        Nombre:</td>
                    <td align="left">
                        <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="odsCodeUser" 
                            DataTextField="Nombre" DataValueField="Codigo" Enabled="False">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Valor:</td>
                    <td align="left">
                        <asp:Label ID="ValorCompraLabel" runat="server" 
                            Text='<%# Bind("ValorCompra") %>' />
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Compra:</td>
                    <td align="left">
                        <asp:Label ID="FechaCompraLabel" runat="server" 
                            Text='<%# Bind("FechaCompra", "{0:d}") %>' />
                    </td>
                </tr>
                <tr>
                    <td  align="right">
                        Venta:</td>
                    <td align="left">
                        <asp:Label ID="FechaVentaLabel" runat="server" 
                            Text='<%# Bind("FechaVenta", "{0:d}") %>' />
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Reserva</td>
                    <td align="left">
                        <asp:CheckBox ID="PorTiqueteCheckBox" runat="server" 
                            Checked='True' />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                            CommandName="New" Text="Nueva Reserva" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:HyperLink ID="HyperLink1" runat="server" 
                            NavigateUrl="~/SeleccionMovil.aspx">Volver</asp:HyperLink>
                    </td>
                </tr>
            </table></center>
        </ItemTemplate>
        <EmptyDataTemplate>
            <table style="width:100%;">
                <tr>
                    <td align="center" class="style1">
                        <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                            CommandName="New" Text="Nueva Reserva" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td align="center">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td align="center">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td align="center">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td align="center">
                        <asp:HyperLink ID="Volver" runat="server" NavigateUrl="~/SeleccionMovil.aspx">Volver</asp:HyperLink>
                    </td>
                </tr>
            </table>
        </EmptyDataTemplate>
    </asp:FormView></center>  
    <asp:ObjectDataSource ID="odsTarifa" runat="server" 
                SelectMethod="consultarTarifas" 
                TypeName="Libreria.SIG.Negocio.TarifaNegocio">
        <SelectParameters>
            <asp:Parameter Name="codigoMenu" Type="Int32" />
            <asp:Parameter Name="cadenaDeConexion" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="odsMenuPorFecha" runat="server" 
                SelectMethod="ConsultaMenusVigentesPorFecha" 
                TypeName="Libreria.SIG.Negocio.MenuNegocio">
        <SelectParameters>
            <asp:SessionParameter DefaultValue="" Name="FechaMenu" SessionField="datetime" 
            Type="DateTime" />
            <asp:Parameter Name="cadenaDeConexion" Type="String" />
        </SelectParameters>
</asp:ObjectDataSource>
    <asp:ObjectDataSource ID="odsCodeUser" runat="server" 
                SelectMethod="usuarioPorCodigo" 
                TypeName="Libreria.SIG.Negocio.ExternoNegocio">
        <SelectParameters>
            <asp:SessionParameter Name="codigo" SessionField="Usuario.identificador" 
                Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="odsVenta" runat="server" 
    InsertMethod="crearVenta" 
           SelectMethod="consultarVentasDeUsuario" 
           TypeName="Libreria.SIG.Negocio.VentaNegocio"
           DeleteMethod="eliminarVenta"
           OnInserted="ObjectDataSourceodsVenta_Inserted">
        <DeleteParameters>
            <asp:Parameter Name="Codigo" Type="Int32" />
            <asp:Parameter Name="cadenaDeConexion" Type="String" />
        </DeleteParameters>
        <SelectParameters>
            <asp:SessionParameter DefaultValue="" Name="codigoUsuario" 
                SessionField="Usuario.identificador" Type="String" />
            <asp:SessionParameter Name="cadenaDeConexion" SessionField="cs" Type="String" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="Codigo" Type="Int32" />
            <asp:Parameter Name="ValorCompra" Type="Double" />
            <asp:Parameter Name="FechaCompra" Type="DateTime" />
            <asp:Parameter Name="FechaVenta" Type="DateTime" />
            <asp:Parameter Name="PorTiquete" Type="Boolean" />
            <asp:Parameter Name="IdentificadorUsuario" Type="String" />
            <asp:Parameter Name="EsReserva" Type="Boolean" />
            <asp:Parameter Name="PorInternet" Type="Boolean" />
            <asp:Parameter Name="CodigoMenu" Type="Int32" />
            <asp:Parameter Name="cadenaDeConexion" Type="String" />
            <asp:Parameter Direction="Output" Name="mensaje" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>
   </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
</asp:Content>
